<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('项目数据关联表新增')"/>
</head>
<body>
<form class="layui-form">
    <div class="mainBox">
        <div class="main-container">
            <div class="main-container">
											
							<div class="layui-form-item">
			                    <label class="layui-form-label">项目id</label>
			                    <div class="layui-input-block">
			                        <input type="text" name="projectId" autocomplete="off" placeholder="项目id" class="layui-input">
			                    </div>
			                </div>
									
											
							<div class="layui-form-item">
			                    <label class="layui-form-label">创建时间</label>
			                    <div class="layui-input-block">
			                        <input type="text" name="createTime" autocomplete="off" placeholder="创建时间" class="layui-input datetime-input">
			                    </div>
			                </div>
									
											
							<div class="layui-form-item">
			                    <label class="layui-form-label">创建人id</label>
			                    <div class="layui-input-block">
			                        <input type="text" name="createUserId" autocomplete="off" placeholder="创建人id" class="layui-input">
			                    </div>
			                </div>
									
											
							<div class="layui-form-item">
			                    <label class="layui-form-label">存储数据</label>
			                    <div class="layui-input-block">
			                        <input type="text" name="content" autocomplete="off" placeholder="存储数据" class="layui-input">
			                    </div>
			                </div>
									
		
            </div>
        </div>
    </div>
    <div class="bottom">
        <div class="button-container">
            <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit="" lay-filter="goviewProjectData-save">
                <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
            <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>
<th:block th:include="include :: footer"/>
<script>
    layui.use(['form','laydate','jquery'], function () {
        let form = layui.form;
        let $ = layui.jquery;
        let MODULE_PATH = rootPath+"/GoviewProjectDataController";
		var laydate = layui.laydate;
        //同时绑定多个
        lay('.datetime-input').each(function(){
          laydate.render({
            elem: this
            ,trigger: 'click'
            ,type: 'datetime'
          });
        });


        //保存
        form.on('submit(goviewProjectData-save)', function (data) {
        	let loader = layer.load();
            $.ajax({
                url: MODULE_PATH+'/add',
                data: data.field,
                dataType: 'json',
                contentType: 'application/x-www-form-urlencoded',
                type: 'post',
                success: function (result) {
                    if (result.code==200) {
                        layer.msg(result.msg, {icon: 1, time: 1000}, function () {
                            parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
                            parent.layui.table.reload("goviewProjectData-table");
                            layer.close(loader);
                        });
                    } else {
                        layer.msg(result.msg, {icon: 2, time: 1000});
                        layer.close(loader);
                    }
                }
            })
            return false;
        });
    })
</script>
</body>
</html>